import React, {useEffect} from 'react';
import {View,} from '@tarojs/components';


import styles from './index.module.scss';
import {Tabbar} from "@taroify/core";
import {HomeOutlined, ListSwitching, ShoppingCartOutlined, UserOutlined} from "@taroify/icons";
import {goMallCart, goMallHome, goMallUser} from "@/mall/Go";

const Index: React.FC<{ value: 0 | 1 | 2 | 3 }> = ({value}) => {

    useEffect(() => {
        load();
    }, []);

    const load = async () => {
    }

    const doChange = async (value) => {
        switch (value) {
            case 0:
                await goMallHome()
                break;
            case 1:
                break;
            case 2:
                await goMallCart()
                break;
            case 3:
                await goMallUser()
                break;
        }


    }

    return (
        <View className={styles.page}>
            <Tabbar value={value} className={styles.tabbar} fixed onChange={(value) => {
                doChange(value)
            }}>
                <Tabbar.TabItem icon={<HomeOutlined/>}>首页</Tabbar.TabItem>
                <Tabbar.TabItem icon={<ListSwitching/>}>分类</Tabbar.TabItem>
                <Tabbar.TabItem icon={<ShoppingCartOutlined/>}>购物车</Tabbar.TabItem>
                <Tabbar.TabItem icon={<UserOutlined/>}>个人中心</Tabbar.TabItem>
            </Tabbar>
        </View>
    );
};

export default Index;
